#ifndef __COLLECTBASE_H__
#define __COLLECTBASE_H__


#include <QThread>
#include <QVector>
#include <QRunnable>
#include <QObject>
#include <QtGui> 
#include <QMap>

#define MUL_THREAD
// #define THREAD_POOL



#ifdef THREAD_POOL

//数据采集抽象类，空的基类
class CollectBase : public QObject, public QRunnable
{
    Q_OBJECT
    private:
        /* data */
    public:
        CollectBase(QObject *parent = nullptr,  bool autoDelete = false);
        virtual ~CollectBase();
        virtual void run() override;

    public:
        // 纯虚函数，调用派生类的数据采集方法
        virtual int dataCollecting(void* args = nullptr)=0;
};

#elif defined(MUL_THREAD)
//数据采集抽象类，空的基类
class CollectBase : public QThread
{
    Q_OBJECT
    public:
        CollectBase(QObject *parent = nullptr);
        virtual ~CollectBase();
        virtual void run() override;

    public:
        // 纯虚函数，调用派生类的数据采集方法
        virtual int dataCollecting(void* args = nullptr)=0;
        // 获取电极名称映射表
        virtual const QMap<int,QString>& getElectrodeMap()=0;
        void collectingEEG(bool state);
        void changeConnectingState(bool state);
        bool is_collecting();
        bool is_connecting();
        // virtual void stopCollecting() = 0;
        void stopCollecting();


    
    signals:
        void isDone(); //线程运行结束信号，只声明不实现
        // virtual void send_ClientData(const QVariant& eegData)=0;

    private:
        /* data */
        bool collectingFlag;
        bool connectingFlag;

};
#else
//数据采集抽象类，空的基类
class CollectBase
{
    Q_OBJECT
    private:
        /* data */
    public:
        // CollectBase(QObject *parent = nullptr);
        // virtual ~CollectBase();
        // virtual void run();

    public:
        // 纯虚函数，调用派生类的数据采集方法
        // virtual int dataCollecting(void* args = nullptr)=0;
    
    signals:
        // void isDone(); //线程运行结束信号，只声明不实现

};


#endif // THREAD_POOL


#endif // !_CollectBase_H_